package com.sino.struts2;

import java.util.Iterator;
import java.util.List;

import com.opensymphony.xwork2.ActionSupport;
import com.sino.business.IPatentManageStatService;
import com.sino.business.IStaticDataService;
import com.sino.model.SbrModel;
import com.sino.util.StringUtils;

public class SbrStatAction extends ActionSupport{
	private IStaticDataService staticDataService;
	private IPatentManageStatService patentManageStatService;

	private List sbrStatList;

	private String sbr;// 基本表推荐单位

	private List basicInfoList;
	private String sbrtype;// 基本表推荐单位
	private String zlid;
	private int patentAllCount;
	

	public int getPatentAllCount() {
		return patentAllCount;
	}
	public void setPatentAllCount(int patentAllCount) {
		this.patentAllCount = patentAllCount;
	}
	public String getPatentStatBySbr(){
		
		sbrStatList=this.getPatentManageStatService().getPatentStatBySbr();
		patentAllCount=this.getSbrCount(sbrStatList.iterator());
		return SUCCESS;
	}
	public String getPatentStatBySbrWithUnit(){
		
		sbrStatList=this.getPatentManageStatService().getPatentStatBySbrWithUnit();
		patentAllCount=this.getSbrCount(sbrStatList.iterator());
		return SUCCESS;
	}
	public String getPatentStatListBySbr(){
	
		try{
		
		basicInfoList=this.getPatentManageStatService().getPatentStatBySbr(zlid);
		
		}catch(Exception e){
			
		}
		try{
	
		}catch(Exception e){
			e.printStackTrace();
		}
		
	
		return SUCCESS;
	}
	public String getPatentStatListBySbrWithUnit(){
		try{
	
		}catch(Exception e){
			
		}
		basicInfoList=this.getPatentManageStatService().getPatentStatBySbrWithUnit(zlid);
	
		return SUCCESS;
	}
	public int getSbrCount(Iterator it){ //获得最长的柱状图值
		   int max=0;
		   while (it.hasNext()){
		   SbrModel o=(SbrModel)it.next();
		  
		   max=max+o.getPatentCount();
	    }
		   return max;   
		   
	   }

	public List getSbrStatList() {
		return sbrStatList;
	}

	public void setSbrStatList(List sbrStatList) {
		this.sbrStatList = sbrStatList;
	}

	public List getBasicInfoList() {
		return basicInfoList;
	}

	public void setBasicInfoList(List basicInfoList) {
		this.basicInfoList = basicInfoList;
	}

	public IPatentManageStatService getPatentManageStatService() {
		return patentManageStatService;
	}

	public void setPatentManageStatService(
			IPatentManageStatService patentManageStatService) {
		this.patentManageStatService = patentManageStatService;
	}

	public String getSbr() {
		return sbr;
	}

	public void setSbr(String sbr) {
		this.sbr = sbr;
	}

	public String getSbrtype() {
		return sbrtype;
	}

	public void setSbrtype(String sbrtype) {
		this.sbrtype = sbrtype;
	}

	public IStaticDataService getStaticDataService() {
		return staticDataService;
	}

	public void setStaticDataService(IStaticDataService staticDataService) {
		this.staticDataService = staticDataService;
	}
	public String getZlid() {
		return zlid;
	}
	public void setZlid(String zlid) {
		this.zlid = zlid;
	}

}
